/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.apertum.diasled.rxtx;

import gnu.io.CommPortIdentifier;
import java.io.File;
import java.util.Enumeration;
import java.util.TimerTask;

/**
 *
 * @author Evgeniy Egorov
 */
public class FindPotrs {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws Exception {

        
        
        int n = 3;
        String[] a = {"a", "c", "z"};
        String[] b = {"c", "f", "z"};

        String[] result = new String[n];
        int j = 0;
        for (int i = 0; i < result.length; i++) {
            if (a[j].compareTo(b[j]) < 0) {
                result[i] = a[j];
                i++;
                if (i < result.length) {
                    result[i] = b[j];
                }
            } else {
                result[i] = a[j];
                i++;
                if (i < result.length) {
                    result[i] = b[j];
                }
            }
            j++;
        }
        for (String i : result) {
            System.out.print(i + " ");
        }
        
        if (true) {
            return;
        }
        
        
        
        

        // Пробежимся по доступным портам и определим возможность использования требуемого порта
        final Enumeration portList = CommPortIdentifier.getPortIdentifiers();

        System.out.println(
                "Порты:");


        while (portList.hasMoreElements()) {
            final CommPortIdentifier portIdTemp = (CommPortIdentifier) portList.nextElement();
            if (portIdTemp.getPortType() == CommPortIdentifier.PORT_SERIAL) {
                System.out.println(portIdTemp.getName());
            }
        }
        File f = new File("E:\\WORK\\diasled-scan\\lib\\comm\\rxtxSerial.dll");

        System.out.println(f.getAbsolutePath());


        final java.util.Timer steps = new java.util.Timer(true);

        steps.schedule(
                new TimerTask() {

                    @Override
                    public void run() {
                        System.out.println("!!!!!!!!!!!!!!!!");
                    }
                },
                500);

        Thread.sleep(
                100);
        //steps.cancel();
        //steps.purge();
        Thread.sleep(
                2000);

    }
}
